package example.e01_expression.e0122;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class TableData {
	
	/** 服务于 pxf 的 语法：@{大区}, @{A}, @{B}*/
	private String[] properties;
	
	/** 表头 */
	private String[] headers;
	/** 表体 */
	private List<Map<String, Object>> dataList;

	public String wrap(String str) {
		return "@{" + str + "}";
	}

	
	@Override
	public String toString() {
		return "TableData [properties=" + Arrays.toString(properties)
				+ ", headers=" + Arrays.toString(headers) + ", dataList="
				+ dataList + "]";
	}

	// 构造器
	public TableData(String[] headers, List<Map<String, Object>> dataList) {
		super();
		this.headers = headers;
		this.dataList = dataList;

		String[] properties = new String[headers.length];
		for (int i = 0; i < headers.length; i++) {
			String header = headers[i];
			String property = wrap(header);
			properties[i] = property;
		}
		this.properties = properties;
	}



	// getter、setter
	public String[] getProperties() {
		return properties;
	}
	public void setProperties(String[] properties) {
		this.properties = properties;
	}
	public String[] getHeaders() {
		return headers;
	}
	public void setHeaders(String[] headers) {
		this.headers = headers;
	}
	public List<Map<String, Object>> getDataList() {
		return dataList;
	}
	public void setDataList(List<Map<String, Object>> dataList) {
		this.dataList = dataList;
	}
}